/**
 * Created by zhangyunqi on 2017/9/10.
 */
public class charu {
    public static void main(String[] args) {
        int[] a = {49, 38, 65, 97, 76, 13, 27, 49, 78, 34, 12, 64, 1};
        System.out.println ( "排序之前：" );
        for (int i = 0; i < a.length; i++) {
            System.out.print ( a[i] + " " );
        }
        //直接插入排序
        for (int i = 1; i < a.length; i++) {
            //待插入元素
            int temp = a[i];
            int j;
                         /*for (j = i-1; j>=0 && a[j]>temp; j--) {
17                 //将大于temp的往后移动一位
18                 a[j+1] = a[j];
19             }*/
            for (j = i - 1; j >= 0; j--) {
                //将大于temp的往后移动一位
                if (a[j] > temp) {
                    a[j + 1] = a[j];
                } else {
                    break;
                }
            }
            a[j + 1] = temp;
        }
        System.out.println ();
        System.out.println ( "排序之后：" );
        for (int i = 0; i < a.length; i++) {
            System.out.print ( a[i] + " " );
        }
        System.out.println ();
        for (int d = 0; d < 10; d++) {
            for (int c = 0; c < 10; c++) {
                for (int b = 0; b < 10; b++) {
                    System.out.print ( "" + b );

                }
                System.out.println ( "" + c );

            }
            System.out.println ( "" + d );
        }
    }

}
